home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / NetClass.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-01-30  |  3.5 KB  |  84 lines

  1. package symantec.itools.db.net;
  2.  
  3. import java.io.DataInputStream;
  4. import java.io.IOException;
  5. import java.util.Hashtable;
  6. import symjava.sql.SQLException;
  7.  
  8. class NetClass {
  9.    static Hashtable _objectNames = null;
  10.  
  11.    static void initTable() {
  12.       if (_objectNames == null) {
  13.          _objectNames = new Hashtable();
  14.          _objectNames.put(new Integer(50), "EOT");
  15.          _objectNames.put(new Integer(51), "NetData");
  16.          _objectNames.put(new Integer(52), "NetString");
  17.          _objectNames.put(new Integer(49), "NetError");
  18.          _objectNames.put(new Integer(54), "ServerList");
  19.          _objectNames.put(new Integer(57), "Param");
  20.          _objectNames.put(new Integer(58), "TextParam");
  21.          _objectNames.put(new Integer(68), "ExceptionList");
  22.          _objectNames.put(new Integer(59), "NetRecord");
  23.          _objectNames.put(new Integer(69), "Char");
  24.          _objectNames.put(new Integer(70), "Binary");
  25.          _objectNames.put(new Integer(71), "VarBinary");
  26.          _objectNames.put(new Integer(72), "LongVarBinary");
  27.          _objectNames.put(new Integer(73), "VarChar");
  28.          _objectNames.put(new Integer(74), "LongVarChar");
  29.          _objectNames.put(new Integer(75), "NetDate");
  30.          _objectNames.put(new Integer(76), "NetTime");
  31.          _objectNames.put(new Integer(77), "NetTimestamp");
  32.          _objectNames.put(new Integer(78), "BigInt");
  33.          _objectNames.put(new Integer(79), "ReservedClassName");
  34.          _objectNames.put(new Integer(80), "NetDouble");
  35.          _objectNames.put(new Integer(81), "NetFloat");
  36.          _objectNames.put(new Integer(82), "NetInteger");
  37.          _objectNames.put(new Integer(83), "NetBignum");
  38.          _objectNames.put(new Integer(84), "Real");
  39.          _objectNames.put(new Integer(85), "SmallInt");
  40.          _objectNames.put(new Integer(86), "TinyInt");
  41.          _objectNames.put(new Integer(87), "Bit");
  42.          _objectNames.put(new Integer(88), "Warning");
  43.          _objectNames.put(new Integer(62), "Attribute");
  44.          _objectNames.put(new Integer(64), "Entity");
  45.       }
  46.  
  47.    }
  48.  
  49.    static Object getObject(short objID) {
  50.       initTable();
  51.       String className = "symantec.itools.db.net." + (String)_objectNames.get(new Integer(objID));
  52.       Object obj = null;
  53.  
  54.       try {
  55.          Class tempClass = Class.forName(className);
  56.          obj = tempClass.newInstance();
  57.       } catch (ClassNotFoundException var4) {
  58.          obj = new NetError();
  59.       } catch (Exception var5) {
  60.       }
  61.  
  62.       return obj;
  63.    }
  64.  
  65.    static Object getNextObject(DataInputStream in) throws ErrorException, IOException, SQLException {
  66.       initTable();
  67.       Object obj = null;
  68.  
  69.       byte b;
  70.       try {
  71.          b = in.readByte();
  72.       } catch (IOException var3) {
  73.          throw new SQLServerConnException();
  74.       }
  75.  
  76.       obj = getObject((short)b);
  77.       if (obj != null) {
  78.          ((ServerObject)obj).read(in);
  79.       }
  80.  
  81.       return obj;
  82.    }
  83. }
  84.